package cn.chinaiptv.apkmanager.bean;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * 应急模板启用或者停用通知
 * 
 * @author Administrator
 *
 */
public class Epgnotification {
	private int epgnotification_id;
	private String epgnotification_platform;
	private String epgnotification_option;
	private int epgnotification_mode;
	private int epgnotification_status;
	private String epgnotification_url;

	/**
	 * 跑马灯post参数
	 * 
	 * @param epgrecomms
	 * @return
	 */
	public static String getPostJson(Epgnotification epgnotification) {
		JSONObject obj = new JSONObject();
		JSONObject headerObj = new JSONObject();
		JSONObject bodyObj = new JSONObject();
		JSONObject templateObj = new JSONObject();
		String result = null;
		try {
			// 封装头部
			headerObj.put("paltform",
					epgnotification.getEpgnotification_platform());
			headerObj
					.put("option", epgnotification.getEpgnotification_option());
			obj.put("header", headerObj);
			// 封装body
			templateObj.put("mode", epgnotification.getEpgnotification_mode());
			templateObj.put("status",
					epgnotification.getEpgnotification_status());
			templateObj.put("url", epgnotification.getEpgnotification_url());
			bodyObj.put("template", templateObj);
			obj.put("body", bodyObj);
			result = obj.toString();
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return result;
	}

	public int getEpgnotification_id() {
		return epgnotification_id;
	}

	public void setEpgnotification_id(int epgnotification_id) {
		this.epgnotification_id = epgnotification_id;
	}

	public String getEpgnotification_platform() {
		return epgnotification_platform;
	}

	public void setEpgnotification_platform(String epgnotification_platform) {
		this.epgnotification_platform = epgnotification_platform;
	}

	public String getEpgnotification_option() {
		return epgnotification_option;
	}

	public void setEpgnotification_option(String epgnotification_option) {
		this.epgnotification_option = epgnotification_option;
	}

	public int getEpgnotification_mode() {
		return epgnotification_mode;
	}

	public void setEpgnotification_mode(int epgnotification_mode) {
		this.epgnotification_mode = epgnotification_mode;
	}

	public int getEpgnotification_status() {
		return epgnotification_status;
	}

	public void setEpgnotification_status(int epgnotification_status) {
		this.epgnotification_status = epgnotification_status;
	}

	public String getEpgnotification_url() {
		return epgnotification_url;
	}

	public void setEpgnotification_url(String epgnotification_url) {
		this.epgnotification_url = epgnotification_url;
	}

	public Epgnotification(int epgnotification_id,
			String epgnotification_platform, String epgnotification_option,
			int epgnotification_mode, int epgnotification_status,
			String epgnotification_url) {
		super();
		this.epgnotification_id = epgnotification_id;
		this.epgnotification_platform = epgnotification_platform;
		this.epgnotification_option = epgnotification_option;
		this.epgnotification_mode = epgnotification_mode;
		this.epgnotification_status = epgnotification_status;
		this.epgnotification_url = epgnotification_url;
	}

	@Override
	public String toString() {
		return "Epgnotification [epgnotification_id=" + epgnotification_id
				+ ", epgnotification_platform=" + epgnotification_platform
				+ ", epgnotification_option=" + epgnotification_option
				+ ", epgnotification_mode=" + epgnotification_mode
				+ ", epgnotification_status=" + epgnotification_status
				+ ", epgnotification_url=" + epgnotification_url + "]";
	}

	public Epgnotification() {
		super();
	}

}
